package com.guangzi.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guangzi.entity.Notice;
import com.guangzi.mapper.NoticeDao;
import com.guangzi.service.AbstractService;
import com.guangzi.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class NoticeServiceImpl extends AbstractService implements NoticeService {

    private NoticeDao noticeDAO;
    @Autowired
    public void setNoticeDAO(NoticeDao noticeDAO) {
        super.setBaseDAO(noticeDAO);
        this.noticeDAO = noticeDAO;
    }

    @Override
    public List<Object> listNotice(int pageIndex, int pageSize) {
        return noticeDAO.listNotice(pageIndex,pageSize);
    }

    @Override
    public PageInfo<Notice> findAll(int pageNo, int pageSize) {
        PageHelper.startPage(pageNo,pageSize);
        List<Notice> list = noticeDAO.findAll();
        PageInfo<Notice> page = new PageInfo<>(list);

        return page;
    }
}
